/**
 * 生成uid规则
 * @param {number} date 注册时的时间戳
 */
const y = 1;
const m= 0;
const d= 0;
const h= 0;
const mi= 0;
const s = 0;

const generateUid = (date) => {
  const year = new Date(date).getFullYear();
  const month = new Date(date).getMonth() + 1;
  const day = new Date(date).getDate();
  const hour = new Date(date).getHours();
  const minute = new Date(date).getMinutes();
  const second = new Date(date).getSeconds();
  const millisecond = date % 1000;

  const uid = '' +
    (year - 2022 + y) +
    (month - 1 + m) +
    (day - 1 + d) +
    (hour + h) +
    (minute + mi) +
    (second + s) +
    millisecond;

  console.log('uid: ', uid);
  return parseInt(uid);
}

module.exports = generateUid;